﻿using University.Workshop.Business;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using University.Workshop.Model;

namespace University.Workshop.Tests
{
    
    
    /// <summary>
    ///This is a test class for WebmasterRequestManagerTest and is intended
    ///to contain all WebmasterRequestManagerTest Unit Tests
    ///</summary>
    [TestClass()]
    public class WebmasterRequestManagerTest
    {


        private TestContext testContextInstance;

        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext
        {
            get
            {
                return testContextInstance;
            }
            set
            {
                testContextInstance = value;
            }
        }

        #region Additional test attributes
        // 
        //You can use the following additional attributes as you write your tests:
        //
        //Use ClassInitialize to run code before running the first test in the class
        //[ClassInitialize()]
        //public static void MyClassInitialize(TestContext testContext)
        //{
        //}
        //
        //Use ClassCleanup to run code after all tests in a class have run
        //[ClassCleanup()]
        //public static void MyClassCleanup()
        //{
        //}
        //
        //Use TestInitialize to run code before running each test
        //[TestInitialize()]
        //public void MyTestInitialize()
        //{
        //}
        //
        //Use TestCleanup to run code after each test has run
        //[TestCleanup()]
        //public void MyTestCleanup()
        //{
        //}
        //
        #endregion


        /// <summary>
        ///A test for HavePendingRequest
        ///</summary>
        [TestMethod()]
        public void HavePendingRequestTest()
        {
            string firstName = "Harry";
            string lastName = "Potter";
            char gender = 'M';
            Random rand = new Random();
            DateTime birthday = DateTime.Now.AddYears(-18);
            string email = "harry" + rand.Next(1000) + "@gmail.com";
            string password = "qwert1";
            string rePassword = "qwert1";
            string department = "Beni";
            string city = "Cercado";
            string movilephone = "" + rand.Next(79999999);
            string phone = "" + rand.Next(4999999);
            UserRegistrationManager.RegisterUser(firstName, lastName, gender, birthday, email, password, rePassword, department, city, movilephone, phone);
            string skills = "I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?";
            bool wantsToReplyTickets = true;
            bool wantsToSetWebmasters = true;
            WebmasterRequest result;
            result = WebmasterRequestManager.RegisterNewRequest(email, skills, wantsToReplyTickets, wantsToSetWebmasters);
            bool expected = true; // TODO: Initialize to an appropriate value
            bool actual;
            actual = WebmasterRequestManager.HavePendingRequest(email);
            Assert.AreEqual(expected, actual);
        }

        /// <summary>
        ///A test for RegisterNewRequest
        ///</summary>
        [TestMethod()]
        public void RegisterNewRequestTest()
        {
            string firstName = "Vilma";
            string lastName = "EsposaDePedro";
            char gender = 'F';
            Random rand = new Random();
            DateTime birthday = DateTime.Now.AddYears(-18);
            string email = "vilma" + rand.Next(400) + "@gmail.com";
            string password = "qwert1";
            string rePassword = "qwert1";
            string department = "Beni";
            string city = "Cercado";
            string movilephone = "" + rand.Next(79999999);
            string phone = "" + rand.Next(4999999);
            UserRegistrationManager.RegisterUser(firstName, lastName, gender, birthday, email, password, rePassword, department, city, movilephone, phone);
            string skills = "I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?I have a lot of skills you know?";
            bool wantsToReplyTickets = true; 
            bool wantsToSetWebmasters = true; 
            WebmasterRequest actual;
            actual = WebmasterRequestManager.RegisterNewRequest(email, skills, wantsToReplyTickets, wantsToSetWebmasters);
            Assert.AreEqual(skills, actual.Skills);
        }
    }
}
